package com.xfzp.d3;

/**
 * 立方体
 * 
 * @author AndroidApe
 * @version 2011-11-10
 */
public class Cube extends Shape {

	/**
	 * 构造立方体
	 */
	public Cube() {
		super((short) 8, new short[] { 1, 2, 0, 2, 3, 0, 0, 3, 4, 3, 7, 4, 0,
				4, 1, 4, 5, 1, 4, 7, 5, 7, 6, 5, 1, 5, 2, 5, 6, 2, 2, 6, 3, 6,
				7, 3 });
	}

	/**
	 * 构造立方体。<br/>
	 * v0, v3, v2, v1组成后面；v5, v6, v7, v4组成前面；<br/>
	 * v1, v5, v4, v0组成左面；v3, v7, v6, v2组成右面；<br/>
	 * v2, v6, v5, v1组成上面；v4, v7, v3, v0组成下面；
	 * 
	 * @param v0
	 *            左下后点
	 * @param v6
	 *            右上前点
	 */
	public Cube(Vertex v0, Vertex v6) {
		this();
		float x0 = v0.x();
		float y0 = v0.y();
		float z0 = v0.z();
		float x6 = v6.x();
		float y6 = v6.y();
		float z6 = v6.z();
		set(v0, new Vertex(x0, y6, z0), new Vertex(x6, y6, z0), new Vertex(x6,
				y0, z0), new Vertex(x0, y0, z6), new Vertex(x0, y6, z6), v6,
				new Vertex(x6, y0, z6));
	}

	/**
	 * 构造立方体。<br/>
	 * v0, v3, v2, v1组成后面；v5, v6, v7, v4组成前面；<br/>
	 * v1, v5, v4, v0组成左面；v3, v7, v6, v2组成右面；<br/>
	 * v2, v6, v5, v1组成上面；v4, v7, v3, v0组成下面；
	 * 
	 * @param v0
	 *            左下后点
	 * @param v1
	 *            左上后点
	 * @param v2
	 *            右上后点
	 * @param v3
	 *            右下后点
	 * @param v4
	 *            左下前点
	 * @param v5
	 *            左上前点
	 * @param v6
	 *            右上前点
	 * @param v7
	 *            右下前点
	 */
	public Cube(Vertex v0, Vertex v1, Vertex v2, Vertex v3, Vertex v4,
			Vertex v5, Vertex v6, Vertex v7) {
		this();
		set(v0, v1, v2, v3, v4, v5, v6, v7);
	}

}
